/*
 * File    : /src/api/task/workflow.js
 * Time    : 2021-09-23 12:29:23
 * Author  : Gray Snail
 * Version : 1.0
 * Contact : shtao2011@sina.com
 * License : Copyright (c) 2021 Gray Snail
 * Desc    : None
 */

import request from '@/utils/request'

// 查询任务流程控制列表
export function listWorkflow(query) {
  return request({
    url: '/task/workflow/list',
    method: 'get',
    params: query,
  })
}

export function getTaskWorkflow(taskId) {
  return request({
    url: '/task/workflow/task/' + taskId,
    method: 'get',
  })
}

export function marketWorkflow(query) {
  return request({
    url: '/task/workflow/market',
    method: 'get',
    params: query,
  })
}

// 查询任务流程控制详细
export function getWorkflow(taskId) {
  return request({
    url: '/task/workflow/' + taskId,
    method: 'get',
  })
}

// 新增任务流程控制
export function addWorkflow(data) {
  return request({
    url: '/task/workflow',
    method: 'post',
    data: data,
  })
}

// 修改任务流程控制
export function updateWorkflow(data) {
  return request({
    url: '/task/workflow',
    method: 'put',
    data: data,
  })
}

// 删除任务流程控制
export function delWorkflow(taskId) {
  return request({
    url: '/task/workflow/' + taskId,
    method: 'delete',
  })
}

// 导出任务流程控制
export function exportWorkflow(query) {
  return request({
    url: '/task/workflow/export',
    method: 'get',
    params: query,
  })
}

// 任务流程控制

export function assignTask(data) {
  return request({
    url: '/task/workflow/assign',
    method: 'put',
    data: data,
  })
}

export function pickTask(taskId) {
  return request({
    url: `/task/workflow/${taskId}/pick`,
    method: 'put',
  })
}

export function finishTask(taskId) {
  return request({
    url: `/task/workflow/${taskId}/finish`,
    method: 'put',
  })
}

export function rejectTask(taskId) {
  return request({
    url: `/task/workflow/${taskId}/reject`,
    method: 'put',
  })
}

export function revokeTask(taskId) {
  return request({
    url: `/task/workflow/${taskId}/revoke`,
    method: 'put',
  })
}
